package cn.yitun.chat.yitunservercommonlib.converter.ot;

import cn.yitun.chat.yitunservercommonlib.dataentity.data.core.chat.LastChatUser;
import cn.yitun.chat.yitunservercommonlib.dataentity.data.core.chat.UserChatHistory;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper(componentModel = "spring")
public interface UserChatHistoryToLastChatUserConverter {

    UserChatHistoryToLastChatUserConverter INSTANCE = Mappers.getMapper(UserChatHistoryToLastChatUserConverter.class);
//    @Mappings({
//            @Mapping(source = "parentId" ,target = "parentId" ),
//            @Mapping(source = "parentUrl" ,target = "parentUrl" ),
//            @Mapping(source = "parentName" ,target = "parentName" ),
//    })
    UserChatHistory poToHistory(LastChatUser dto);

    List<UserChatHistory> poToHistory(List<LastChatUser> dtoList);

    @InheritInverseConfiguration
    LastChatUser historyToPo(UserChatHistory dto);
    @InheritInverseConfiguration
    List<LastChatUser> historyToPo(List<UserChatHistory> dtoList);
}
